package com.boxuegu.guanweihua25.databinding.utils;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitUtils {
   static Retrofit retrofit;
    public static  Retrofit getRetrofit(){//单例模式

        if(retrofit == null) {
              retrofit = new Retrofit.Builder()
                    .baseUrl("http://148.70.46.9:8080/boxuegu/bxg/")
                    .addConverterFactory(GsonConverterFactory.create())//添加json解析方式
                    .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                    .build();



        }
        return retrofit;
    }
}
